3.1.12 \(\int \frac {1}{(-1+x^2)^2 \sqrt {-1+x+x^2}} \, dx\) [12]

Optimal. Leaf size=70 \[ \frac {\sqrt {-1+x+x^2}}{2 \left (1-x^2\right )}-\frac {1}{8} \tan ^{-1}\left (\frac {3+x}{2 \sqrt {-1+x+x^2}}\right )-\frac {5}{8} \tanh ^{-1}\left (\frac {1-3 x}{2 \sqrt {-1+x+x^2}}\right ) \]

[Out]

-1/8*arctan(1/2*(3+x)/(x^2+x-1)^(1/2))-5/8*arctanh(1/2*(1-3*x)/(x^2+x-1)^(1/2))+1/2*(x^2+x-1)^(1/2)/(-x^2+1)

________________________________________________________________________________________

Rubi [A]
time = 0.03, antiderivative size = 70, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 5, integrand size = 18, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.278, Rules used = {990, 1047, 738, 212, 210} \begin {gather*} -\frac {1}{8} \text {ArcTan}\left (\frac {x+3}{2 \sqrt {x^2+x-1}}\right )+\frac {\sqrt {x^2+x-1}}{2 \left (1-x^2\right )}-\frac {5}{8} \tanh ^{-1}\left (\frac {1-3 x}{2 \sqrt {x^2+x-1}}\right ) \end {gather*}

Antiderivative was successfully verified.

[In]

Int[1/((-1 + x^2)^2*Sqrt[-1 + x + x^2]),x]

[Out]

Sqrt[-1 + x + x^2]/(2*(1 - x^2)) - ArcTan[(3 + x)/(2*Sqrt[-1 + x + x^2])]/8 - (5*ArcTanh[(1 - 3*x)/(2*Sqrt[-1
+ x + x^2])])/8

Rule 210

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(-(Rt[-a, 2]*Rt[-b, 2])^(-1))*ArcTan[Rt[-b, 2]*(x/Rt[-a, 2])
], x] /; FreeQ[{a, b}, x] && PosQ[a/b] && (LtQ[a, 0] || LtQ[b, 0])

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 738

Int[1/(((d_.) + (e_.)*(x_))*Sqrt[(a_.) + (b_.)*(x_) + (c_.)*(x_)^2]), x_Symbol] :> Dist[-2, Subst[Int[1/(4*c*d
^2 - 4*b*d*e + 4*a*e^2 - x^2), x], x, (2*a*e - b*d - (2*c*d - b*e)*x)/Sqrt[a + b*x + c*x^2]], x] /; FreeQ[{a,
b, c, d, e}, x] && NeQ[b^2 - 4*a*c, 0] && NeQ[2*c*d - b*e, 0]

Rule 990

Int[((a_.) + (c_.)*(x_)^2)^(p_)*((d_.) + (e_.)*(x_) + (f_.)*(x_)^2)^(q_), x_Symbol] :> Simp[(2*a*c^2*e + c*(2*
c^2*d - c*(2*a*f))*x)*(a + c*x^2)^(p + 1)*((d + e*x + f*x^2)^(q + 1)/((-4*a*c)*(a*c*e^2 + (c*d - a*f)^2)*(p +
1))), x] - Dist[1/((-4*a*c)*(a*c*e^2 + (c*d - a*f)^2)*(p + 1)), Int[(a + c*x^2)^(p + 1)*(d + e*x + f*x^2)^q*Si
mp[2*c*((c*d - a*f)^2 - ((-a)*e)*(c*e))*(p + 1) - (2*c^2*d - c*(2*a*f))*(a*f*(p + 1) - c*d*(p + 2)) - e*(-2*a*
c^2*e)*(p + q + 2) + (2*f*(2*a*c^2*e)*(p + q + 2) - (2*c^2*d - c*(2*a*f))*((-c)*e*(2*p + q + 4)))*x + c*f*(2*c
^2*d - c*(2*a*f))*(2*p + 2*q + 5)*x^2, x], x], x] /; FreeQ[{a, c, d, e, f, q}, x] && NeQ[e^2 - 4*d*f, 0] && Lt
Q[p, -1] && NeQ[a*c*e^2 + (c*d - a*f)^2, 0] &&  !( !IntegerQ[p] && ILtQ[q, -1]) &&  !IGtQ[q, 0]

Rule 1047

Int[((g_.) + (h_.)*(x_))/(((a_) + (c_.)*(x_)^2)*Sqrt[(d_.) + (e_.)*(x_) + (f_.)*(x_)^2]), x_Symbol] :> With[{q
 = Rt[(-a)*c, 2]}, Dist[h/2 + c*(g/(2*q)), Int[1/((-q + c*x)*Sqrt[d + e*x + f*x^2]), x], x] + Dist[h/2 - c*(g/
(2*q)), Int[1/((q + c*x)*Sqrt[d + e*x + f*x^2]), x], x]] /; FreeQ[{a, c, d, e, f, g, h}, x] && NeQ[e^2 - 4*d*f
, 0] && PosQ[(-a)*c]

Rubi steps

\begin {align*} \int \frac {1}{\left (-1+x^2\right )^2 \sqrt {-1+x+x^2}} \, dx &=\frac {\sqrt {-1+x+x^2}}{2 \left (1-x^2\right )}-\frac {1}{4} \int \frac {3+2 x}{\left (-1+x^2\right ) \sqrt {-1+x+x^2}} \, dx\\ &=\frac {\sqrt {-1+x+x^2}}{2 \left (1-x^2\right )}+\frac {1}{8} \int \frac {1}{(1+x) \sqrt {-1+x+x^2}} \, dx-\frac {5}{8} \int \frac {1}{(-1+x) \sqrt {-1+x+x^2}} \, dx\\ &=\frac {\sqrt {-1+x+x^2}}{2 \left (1-x^2\right )}-\frac {1}{4} \text {Subst}\left (\int \frac {1}{-4-x^2} \, dx,x,\frac {-3-x}{\sqrt {-1+x+x^2}}\right )+\frac {5}{4} \text {Subst}\left (\int \frac {1}{4-x^2} \, dx,x,\frac {-1+3 x}{\sqrt {-1+x+x^2}}\right )\\ &=\frac {\sqrt {-1+x+x^2}}{2 \left (1-x^2\right )}-\frac {1}{8} \tan ^{-1}\left (\frac {3+x}{2 \sqrt {-1+x+x^2}}\right )-\frac {5}{8} \tanh ^{-1}\left (\frac {1-3 x}{2 \sqrt {-1+x+x^2}}\right )\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.19, size = 62, normalized size = 0.89 \begin {gather*} -\frac {\sqrt {-1+x+x^2}}{2 \left (-1+x^2\right )}-\frac {1}{4} \tan ^{-1}\left (1+x-\sqrt {-1+x+x^2}\right )+\frac {5}{4} \tanh ^{-1}\left (1-x+\sqrt {-1+x+x^2}\right ) \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[1/((-1 + x^2)^2*Sqrt[-1 + x + x^2]),x]

[Out]

-1/2*Sqrt[-1 + x + x^2]/(-1 + x^2) - ArcTan[1 + x - Sqrt[-1 + x + x^2]]/4 + (5*ArcTanh[1 - x + Sqrt[-1 + x + x
^2]])/4

________________________________________________________________________________________

Maple [A]
time = 0.20, size = 84, normalized size = 1.20

method result size
risch \(-\frac {\sqrt {x^{2}+x -1}}{2 \left (x^{2}-1\right )}+\frac {5 \arctanh \left (\frac {-1+3 x}{2 \sqrt {\left (-1+x \right )^{2}-2+3 x}}\right )}{8}+\frac {\arctan \left (\frac {-3-x}{2 \sqrt {\left (1+x \right )^{2}-2-x}}\right )}{8}\) \(63\)
default \(-\frac {\sqrt {\left (-1+x \right )^{2}-2+3 x}}{4 \left (-1+x \right )}+\frac {5 \arctanh \left (\frac {-1+3 x}{2 \sqrt {\left (-1+x \right )^{2}-2+3 x}}\right )}{8}+\frac {\sqrt {\left (1+x \right )^{2}-2-x}}{4+4 x}+\frac {\arctan \left (\frac {-3-x}{2 \sqrt {\left (1+x \right )^{2}-2-x}}\right )}{8}\) \(84\)
trager \(-\frac {\sqrt {x^{2}+x -1}}{2 \left (x^{2}-1\right )}-\frac {\RootOf \left (\textit {\_Z}^{2}+1\right ) \ln \left (\frac {-x \RootOf \left (\textit {\_Z}^{2}+1\right )+2 \sqrt {x^{2}+x -1}-3 \RootOf \left (\textit {\_Z}^{2}+1\right )}{1+x}\right )}{8}+\frac {5 \ln \left (-\frac {2 \sqrt {x^{2}+x -1}-1+3 x}{-1+x}\right )}{8}\) \(87\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(1/(x^2-1)^2/(x^2+x-1)^(1/2),x,method=_RETURNVERBOSE)

[Out]

-1/4/(-1+x)*((-1+x)^2-2+3*x)^(1/2)+5/8*arctanh(1/2*(-1+3*x)/((-1+x)^2-2+3*x)^(1/2))+1/4/(1+x)*((1+x)^2-2-x)^(1
/2)+1/8*arctan(1/2*(-3-x)/((1+x)^2-2-x)^(1/2))

________________________________________________________________________________________

Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(x^2-1)^2/(x^2+x-1)^(1/2),x, algorithm="maxima")

[Out]

integrate(1/(sqrt(x^2 + x - 1)*(x^2 - 1)^2), x)

________________________________________________________________________________________

Fricas [A]
time = 1.66, size = 82, normalized size = 1.17 \begin {gather*} \frac {2 \, {\left (x^{2} - 1\right )} \arctan \left (-x + \sqrt {x^{2} + x - 1} - 1\right ) + 5 \, {\left (x^{2} - 1\right )} \log \left (-x + \sqrt {x^{2} + x - 1} + 2\right ) - 5 \, {\left (x^{2} - 1\right )} \log \left (-x + \sqrt {x^{2} + x - 1}\right ) - 4 \, \sqrt {x^{2} + x - 1}}{8 \, {\left (x^{2} - 1\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(x^2-1)^2/(x^2+x-1)^(1/2),x, algorithm="fricas")

[Out]

1/8*(2*(x^2 - 1)*arctan(-x + sqrt(x^2 + x - 1) - 1) + 5*(x^2 - 1)*log(-x + sqrt(x^2 + x - 1) + 2) - 5*(x^2 - 1
)*log(-x + sqrt(x^2 + x - 1)) - 4*sqrt(x^2 + x - 1))/(x^2 - 1)

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {1}{\left (x - 1\right )^{2} \left (x + 1\right )^{2} \sqrt {x^{2} + x - 1}}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(x**2-1)**2/(x**2+x-1)**(1/2),x)

[Out]

Integral(1/((x - 1)**2*(x + 1)**2*sqrt(x**2 + x - 1)), x)

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 143 vs. \(2 (52) = 104\).
time = 3.64, size = 143, normalized size = 2.04 \begin {gather*} \frac {2 \, {\left (x - \sqrt {x^{2} + x - 1}\right )}^{3} + 3 \, {\left (x - \sqrt {x^{2} + x - 1}\right )}^{2} - x + \sqrt {x^{2} + x - 1} - 1}{2 \, {\left ({\left (x - \sqrt {x^{2} + x - 1}\right )}^{4} - 2 \, {\left (x - \sqrt {x^{2} + x - 1}\right )}^{2} - 4 \, x + 4 \, \sqrt {x^{2} + x - 1}\right )}} + \frac {1}{4} \, \arctan \left (-x + \sqrt {x^{2} + x - 1} - 1\right ) + \frac {5}{8} \, \log \left ({\left | -x + \sqrt {x^{2} + x - 1} + 2 \right |}\right ) - \frac {5}{8} \, \log \left ({\left | -x + \sqrt {x^{2} + x - 1} \right |}\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(x^2-1)^2/(x^2+x-1)^(1/2),x, algorithm="giac")

[Out]

1/2*(2*(x - sqrt(x^2 + x - 1))^3 + 3*(x - sqrt(x^2 + x - 1))^2 - x + sqrt(x^2 + x - 1) - 1)/((x - sqrt(x^2 + x
 - 1))^4 - 2*(x - sqrt(x^2 + x - 1))^2 - 4*x + 4*sqrt(x^2 + x - 1)) + 1/4*arctan(-x + sqrt(x^2 + x - 1) - 1) +
 5/8*log(abs(-x + sqrt(x^2 + x - 1) + 2)) - 5/8*log(abs(-x + sqrt(x^2 + x - 1)))

________________________________________________________________________________________

Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int \frac {1}{{\left (x^2-1\right )}^2\,\sqrt {x^2+x-1}} \,d x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(1/((x^2 - 1)^2*(x + x^2 - 1)^(1/2)),x)

[Out]

int(1/((x^2 - 1)^2*(x + x^2 - 1)^(1/2)), x)

________________________________________________________________________________________